package cn.edu.web;

import cn.edu.pojo.All;
import cn.edu.pojo.InfoPageBean;
import cn.edu.pojo.PieData;
import cn.edu.service.dep_InfomationService;
import cn.edu.service.impl.dep_InfomationServiceImpl;
import cn.edu.service.impl.lead_InfomationServiceImpl;
import cn.edu.service.lead_InfomationService;
import com.alibaba.fastjson.JSON;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.BufferedReader;
import java.io.IOException;
import java.util.List;

/**
 * @author Davey chan
 */
@WebServlet("/leadInfomation/*")
public class lead_InfomationServlet extends BaseServlet {
    private lead_InfomationService tService = new lead_InfomationServiceImpl();



    public void getPie(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        //接收页面返回的教师ID


//        调用Service的同意
        List<PieData> pie = tService.getpie();
        String jsonString = JSON.toJSONString(pie);
//        响应数据
        response.setContentType("text/json;charset=utf-8");
//        返回成功的标识
        response.getWriter().write(jsonString);


    }
    //  获取柱状图的数据
    public void getBar1(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        //接收页面返回的教师ID
//        调用Service的同意
        List<Integer> bar = tService.getBar1();
        String jsonString = JSON.toJSONString(bar);
//        响应数据
        response.setContentType("text/json;charset=utf-8");
//        返回成功的标识
        response.getWriter().write(jsonString);


    }
    public void getBar2(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        //接收页面返回的教师ID
//        调用Service的同意
        List<Integer> bar = tService.getBar2();
        String jsonString = JSON.toJSONString(bar);
//        响应数据
        response.setContentType("text/json;charset=utf-8");
//        返回成功的标识
        response.getWriter().write(jsonString);


    }
    public void getBar3(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        //接收页面返回的教师ID
//        调用Service的同意
        List<Integer> bar = tService.getBar3();
        String jsonString = JSON.toJSONString(bar);
//        响应数据
        response.setContentType("text/json;charset=utf-8");
//        返回成功的标识
        response.getWriter().write(jsonString);


    }

}
